typedef struct {
GdkWindow *window;
GdkVisual *visual;
+ GdkGLContext *shared_context;
guint realized : 1;
guint use_texture_rectangle : 1;
PROP_WINDOW,
PROP_VISUAL,
+ PROP_SHARED_CONTEXT,
LAST_PROP
};
g_clear_object (&priv->window);
g_clear_object (&priv->visual);
+ g_clear_object (&priv->shared_context);
G_OBJECT_CLASS (gdk_gl_context_parent_class)->dispose (gobject);
}
}
break;
+ case PROP_SHARED_CONTEXT:
+ {
+ GdkGLContext *context = g_value_get_object (value);
+
+ if (context != NULL)
+ priv->shared_context = g_object_ref (context);
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
g_value_set_object (value, priv->visual);
break;
+ case PROP_SHARED_CONTEXT:
+ g_value_set_object (value, priv->shared_context);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
+ /**
+ * GdkGLContext:shared-context:
+ *
+ * The #GdkGLContext that this context is sharing data with, or #NULL
+ *
+ * Since: 3.16
+ */
+ obj_pspecs[PROP_SHARED_CONTEXT] =
+ g_param_spec_object ("shared-context",
+ P_("Shared context"),
+ P_("The GL context this context share data with"),
+ GDK_TYPE_GL_CONTEXT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
gobject_class->set_property = gdk_gl_context_set_property;
gobject_class->get_property = gdk_gl_context_get_property;
gobject_class->dispose = gdk_gl_context_dispose;
return priv->window;
}
+/**
+ * gdk_gl_context_get_shared_context:
+ * @context: a #GdkGLContext
+ *
+ * Retrieves the #GdkGLContext that this @context share data with.
+ *
+ * Returns: (transfer none): a #GdkGLContext or %NULL
+ *
+ * Since: 3.16
+ */
+GdkGLContext *
+gdk_gl_context_get_shared_context (GdkGLContext *context)
+{
+ GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+
+ g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
+
+ return priv->shared_context;
+}
+
/**
* gdk_gl_context_clear_current:
*